<%@ page import="java.sql.Connection" %>
<%@ page import="java.sql.DriverManager" %>
<%@ page import="kr.sdworld.common.util.generator.IDGenerator" %>
<%@ page import="java.sql.PreparedStatement" %>
<%@ page import="java.sql.Timestamp" %>
<%@ page import="java.util.Calendar" %><%
    Class.forName("oracle.jdbc.driver.OracleDriver");

    try
    {
        Connection conn = DriverManager.getConnection("jdbc:oracle:thin:@ora-003.cafe24.com:1521:orcl", "miru032", "my1004sd");

        long objId = IDGenerator.generate();
        String userIp = request.getRemoteAddr();
        String commentId = request.getParameter("commentId");
        String replyId = request.getParameter("replyId");
        String replyText = request.getParameter("replyText");
        Timestamp nowData = new Timestamp(Calendar.getInstance().getTimeInMillis());

        StringBuilder sbQuery = new StringBuilder();
        sbQuery.append("INSERT INTO WEDDING_COMMENT_REPLY(OBJ_ID, REPLY_ID, REPLY_TEXT, USER_IP, REG_DT, COMMENT_ID) ");
        sbQuery.append("VALUES(?, ?, ?, ?, ?, ?)");

        PreparedStatement pstmt = conn.prepareStatement(sbQuery.toString());
        pstmt.setLong(1, objId);
        pstmt.setString(2, replyId);
        pstmt.setString(3, replyText);
        pstmt.setString(4, userIp);
        pstmt.setTimestamp(5, nowData);
        pstmt.setLong(6, Long.valueOf(commentId));

        int result = pstmt.executeUpdate();

        conn.close();
    }
    catch(Exception e) {
        e.printStackTrace();
    }
%>